<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        echo "<h1>Eindimensionales Array</h1>";
        $brands = array("Audi", "Ford", "Dodge", "Chevrolete");
        foreach ($brands as $value) {
            echo "$value" . "<br>";
        }

        echo "<h1>Eindimensionales Assoziatives Array</h1>";
        $wochentage = array(
            "so" => "Sonntag",
            "mo" => "Montag",
            "di" => "Dienstag",
            "mi" => "Mittwoch",
            "do" => "Donnerstag",
            "fr" => "Freitag",
            "sa" => "Samstag");
        $day_keys = array_keys($wochentage);

        foreach ($day_keys as $key) {
            echo $key . " = ";
            echo $wochentage[$key] . " ";
            echo "<br>";
        }

        echo "<h1>Mehrdimensionales Array</h1>";

        $brand = array(
            array("Audi", "A4"),
            array("Chevrolete", "Chevelle"),
            array("Ddoge", "Charger")
        );

        foreach ($brand as $row) {
            foreach ($row as $column) {
                echo $column . ", ";
            }
            echo "<br>";
        }

        echo "<h1>Mehrdimensionales Assoziatives Array</h1>";
        $table = array(
            "company car" => array("brand" => "AUDI", "model" => "A6", "price" => 30000),
            "private car" => array("brand" => "FORD", "model" => "Mustang", "price" => 25000),
        );
        echo "<table border=\"1\">";
        
        $col_keys = array_keys($table[array_keys($table)[0]]);
        echo "<tr>";
        echo "<td></td>";
        foreach ($col_keys as $col_key) {
            echo "<td>" . $col_key . "</td>";
        }
        echo "</tr>";
        foreach ($table as $row_key => $row) {
            echo "<tr>";
            echo "<td>" . $row_key . "</td>";
            foreach ($row as $column) {
                echo "<td>";
                echo $column . " ";
                echo "</td>";
            }
            echo "</tr>";
        }
        echo "</table>";

        echo "<h1>Funktionstest</h1>";

        function convert($string1, $string2) {
            // funkion1
            $count = strlen($string2);

            //funktion2und3
            $result = "'".$string1."' has been turned upper case at " . date("H:i:s") . " => " . strtoupper($string1);
            $result = $result . "<br>" . $string2 . " has " . $count . " characters.";
            return ( $result );
        }

        echo convert("test", "hello");
        ?>
    </body>
</html>
